import http from "@/utils/http";

export const loginAPI = (username: string, password: string) => {
  return http({
    url: "/model/admin/login",
    method: "POST",
    params: {
      username,
      password,
    },
  });
};

export const uploadFileAPI = (data: FormData) => {
  return http({
    url: "/model/admin/upload",
    method: "POST",
    data,
  });
};

export const addModelAPI = (data: {
  name: string;
  headImage: string;
  sex: number;
  height: string;
  bwh: string;
  hair: string;
  eyes: string;
  shoes: string;
}) => {
  return http({
    url: "/model/admin/add",
    method: "POST",
    data,
  });
};

export const editModelAPI = (data: {
  id: number;
  name: string;
  headImage: string;
  sex: number;
  height: string;
  bwh: string;
  hair: string;
  eyes: string;
  shoes: string;
}) => {
  return http({
    url: "/model/admin/edit",
    method: "POST",
    data,
  });
};

export const addModelImagesAPI = (id: number, imageUrl: string) => {
  return http({
    url: "/model/admin/addImages/" + id,
    method: "POST",
    params: {
      imageUrl,
    },
  });
};

export const deleteImageAPI = (id: number) => {
  return http({
    url: "/model/admin/deleteImage/" + id,
    method: "DELETE",
  });
};

export const deleteModelAPI = (id: number) => {
  return http({
    url: "/model/admin/delete/" + id,
    method: "DELETE",
  });
};

export const searchModelAllImagesAPI = (id: number) => {
  return http({
    url: "/model/admin/getAllImages/" + id,
    method: "GET",
  });
};

export const searchProfileAPI = () => {
  return http({
    url: "/model/admin/getInfo",
    method: "GET",
  });
};

export const eidtProfileAPI = (data: {
  id: number;
  username: string;
  password: string;
  email: string;
}) => {
  return http({
    url: "/model/admin/editInfo",
    method: "POST",
    data,
  });
};

export const editAboutAPI = (data: {
  id: number;
  theme: string;
  content: string;
  images: string;
}) => {
  return http({
    url: "/model/admin/editAbout",
    method: "POST",
    data,
  });
};

export const getAboutAPI = () => {
  return http({
    url: "/model/admin/getAbout",
    method: "GET",
  });
};

export const getCustomerMessageAPI = () => {
  return http({
    url: "/model/admin/showContact",
    method: "GET",
  });
};

export const deleteCustomerMessageAPI = (id: number) => {
  return http({
    url: "/model/admin/deleteContact/" + id,
    method: "DELETE",
  });
};

export const searchAllMaleModelAPI = (
  page: number,
  pageSize: number,
  name: string
) => {
  return http({
    url: "/model/admin/men",
    method: "GET",
    params: {
      page,
      pageSize,
      name,
    },
  });
};

export const searchAllFemaleModelAPI = (
  page: number,
  pageSize: number,
  name: string
) => {
  return http({
    url: "/model/admin/women",
    method: "GET",
    params: {
      page,
      pageSize,
      name,
    },
  });
};

export const pageSearchMessageBoxAPI = (
  page: number,
  pageSize: number,
  name: string,
  customerEmail: string
) => {
  return http({
    url: "/model/admin/pageContact",
    method: "GET",
    params: {
      page,
      pageSize,
      name,
      customerEmail,
    },
  });
};

export const searchAllModelAPI=()=>{
  return http({
    url:'/model/admin/getAll',
    method:"GET"
  })
}

export const changeOrderAPI=(data:{
  id:number;
  arrange:number;
  name:string;
  headImage:string;
  sex:number;
  height:string;
  bwh:string;
  hair:string;
  eyes:string;
  shoes:string;
})=>{
  return http({
    url:"/model/admin/changeOrder",
    method:"POST",
    data
  })
}